/**
 * <p>Copyright (c) 2011 深圳市鹏途信息技术有限公司 </p>
 * <p>				   All right reserved. 		     </p>
 * 
 * <p>项目名称 ： 	东莞交通工程质量监督综合业务系统        </p>
 * <p>创建者   :	libitum 
 * 
 * <p>描   述  :   ReportBasic for com.pengtu.entity.business    </p>
 * 
 * <p>最后修改 : $: 2011-7-12-下午04:10:17 v 1.0.0	 libitum   $     </p>
 * 
*/
package com.pengtu.entity.business;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToMany;

import org.hibernate.annotations.Where;

import com.pengtu.entity.IdEntity;
import com.pengtu.entity.app.Attachment;

/**
 * 监督工作对外发文的 基类
 * 
 * ReportBasic
 * 
 * 2011-9-17 下午04:23:12
 * 
 * @version 1.0.0
 *
 */
@MappedSuperclass
public abstract class BasicReport extends IdEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private String projId; // 工程
	private String orgName; // 收文单位
	private String cc;		//抄送单位
	private Date   reportDate; // 报告出具时间
	private String end;		 // 是否已经发出
	private String content; // 报告关键内容
	private String remark; // 备注
	private String reportFile; // 附件资料
	private Set<Attachment> attachments =  new HashSet<Attachment>(0);

	@Column(name = "PROJID")
	public String getProjId() {
		return projId;
	}

	public void setProjId(String projId) {
		this.projId = projId;
	}

	@Column(name = "ORGNAME")
	public String getOrgName() {
		return orgName;
	}

	public void setOrgName(String orgName) {
		this.orgName = orgName;
	}

	@Column(name = "REPORTDATE")
	public Date getReportDate() {
		return reportDate;
	}

	public void setReportDate(Date reportDate) {
		this.reportDate = reportDate;
	}

	@Column(name = "CONTENT")
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Column(name = "REMARK")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "REPORTFILE")
	public String getReportFile() {
		return reportFile;
	}

	public void setReportFile(String reportFile) {
		this.reportFile = reportFile;
	}

	@OneToMany(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
	@JoinColumn(name = "TABLEID")
	@Where(clause="delFlag = 0")
	public Set<Attachment> getAttachments() {
		return attachments;
	}

	public void setAttachments(Set<Attachment> attachments) {
		this.attachments = attachments;
	}
//
//	@Transient
//	public Attachment getAttachment() {
//		if (attachments.iterator().hasNext())
//			return attachments.iterator().next();
//		return new Attachment();
//	}
//
//	public void setAttachment(Attachment attachment) {
//		attachments.clear();
//		attachments.add(attachment);
//	}
	@Column(name = "END")
	public String getEnd() {
		return end;
	}

	public void setEnd(String end) {
		this.end = end;
	}
	
	@Column(name = "CC")
	public String getCc() {
		return cc;
	}

	public void setCc(String cc) {
		this.cc = cc;
	}
}
